﻿<!doctype html>
<html><!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>客户推荐列表</title>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="../js/common.js"></script>
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script>
<link href="../css/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/shopSelecterNew.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<script type="text/javascript" src="../js/find.js"></script>
	<link rel="stylesheet" href="../css/default.css" />
	<script type="text/javascript" src="../js/doubleDate2.0.js"></script> 
<script type="text/javascript">
$(function(){
	
	$('.doubledate').kuiDate({
		className:'doubledate',
		isDisabled: "0"  // isDisabled为可选参数，“0”表示今日之前不可选，“1”标志今日之前可选
	});

});
</script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<style type="text/css">
#window_change p label span img{
    border: 1px solid #CCCCCC;
    height: 51px;
    vertical-align: middle;
    width: 75px;

}

</style>

<script type="text/javascript" >
$(function(){
	$("#shopIsChoosed").click(function(){
		if($("#shopIsChoosed").is(":checked")){
			$("#shopName").attr("disabled",false);
			$("#research").attr("disabled",false);
			
		}else{
			$("#shopName").attr("disabled",true);

		}
	});
})
function  downRescouse(){
	var mp=$("#mp").val().replace(/\s/gi,'');	
	var name=$("#custName").val().replace(/\s/gi,'');
	var type=$("#type").val();
	var shopId="";
	if($("#shopIsChoosed").is(":checked")){	
		shopId=$("#shopName").val();
		if(shopId!=""&&shopId!=null){
			
		}else{
			shopId="";
		}
	}
	
	var params = {'mp':mp,'name':name,'type':type,'shopId':shopId}
	window.location.href="../recommendMan/export/csv?"+$.param(params)

	}
	




function deleteInfo(id){
	
		$.post("../recommendMan/edit/editStatus",{"id":id,"status":1}, function(data) {
			var dt = JSON.parse(data);
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"修改出错",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					getTryDriverList();
					art.dialog({fixed:true, lock: true,content:"处理成功",icon:'succeed',ok:true});	
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
		});
	
}

	
	
function popPoint(id){
	art.dialog({fixed:true, lock: true,content:"确认处理该条数据？",icon:'question',ok: function(){ deleteInfo(id)},cancel:true});
	}

function search(){
	getTryDriverList(1)
}

function getTryDriverList (s){
	if(IsNotEmpty(s)){
		index=s
	}
	
	var mp=$("#mp").val().replace(/\s/gi,'');	
	var name=$("#custName").val().replace(/\s/gi,'');
	var recommendName=$("#recommendName").val().replace(/\s/gi,'');
	var type=$("#type").val();
	var shopId="";
	if($("#shopIsChoosed").is(":checked")){	
		shopId=$("#shopName").val();
		if(shopId!=""&&shopId!=null){
			
		}else{
			shopId="";
		}
	}
	
	var params = {'mp':mp,'name':name,'type':type,'shopId':shopId,'custName':recommendName}
	var dt = _findInfo("../recommendMan/find/recommedManList/"+(index - 1)+"/10", params);
	if(IsNotEmpty(dt)&&dt.state==0){
		 $("#memberList tbody").empty()

		for ( var i = 0; i < dt.result.data.length; i++) {
			var htm="<tr>"
			 htm+="<td>"+_getStringOfJson(i, dt, "shopName")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "recommendedName")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "mp")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "recommendName")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "typeName")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "memo")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "staName")+"</td>"
			 htm+="<td>"+_getStringOfJson(i, dt, "createdTime")+"</td>"
			 var status = _getIntOfJson(i, dt, "status")
			 if(status==0){
				 
			 htm+="<td><input class=\"common_btn\" type=\"button\" onclick=\"popPoint("+_getIntOfJson(i, dt, "id")+")\" value=\"已处理\"></td>"
			 }else{
				 
			 htm+="<td></td>"
			 }
			 htm+="</tr>"
			 $("#memberList tbody").append(htm)
		}
/* 		_loadInfo(dt, "memberList", param)
 */		$("#memberList tbody tr").each(function(){
			
		})
		_loadPage("pager", index, 10, dt, getTryDriverList, "NoResult");
		$("#sup").html("共"+dt.result.len+"条");		
	}
}

</script>
</head>

<body>

<div class="container" id="container">
  <div class="container_R fr">
	<div class="place">客户推荐</div>
    <div class="member_search">

    <p>
   <span>
        <input type="checkbox" id="shopIsChoosed" style="width:auto;height:auto;border:none;">店面：</span>
        <select id="shopName" onclick="openShopListPanel(this)" disabled="disabled">
        </select>
        <span>客户姓名：</span>
                 <input type="text" id="custName" class="absoluteTxt">
        <span>客户电话：</span>
                 <input type="text" id="mp" class="absoluteTxt">
        </p><p>
         <span>
       		推荐类型：</span>
        <select id="type" >
        <option value="">所有</option>
        <option value="1">维修</option>
        <option value="2">试驾</option>
        <option value="3">保养</option>
        </select>
        <span>推荐人姓名：</span>
                 <input type="text" id="recommendName" class="absoluteTxt">
        <input type="button" value="查询" class="btn" onclick="search()"></p></div>
    
    <table width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0" id="memberList">
    	<caption><strong>客户推荐列表        <span id="sup">共0条</span> </strong>  <a href="javascript:void(0)" onclick="downRescouse();">导出数据</a> </caption>
    	<thead>
    	<tr>
    		<th width="50">店面</th>
        	<th width="30">客户姓名</th>
        	<th width="50">客户电话</th>
        	<th width="50">推荐人姓名</th>
        	<th width="50">推荐类型</th>
        	<th width="50" >备注</th>
        	<th width="40">状态</th>
        	<th width="40">推荐时间</th>
        	<th width="40">操作</th>
        </tr>
        </thead>
        <tbody>
        	
        </tbody>
    </table>
    <div id="NoResult"  class="Nothing" style="text-align:center;display: none;">无符合条件的数据！</div>
    <div id="pager" style="float: right;"></div>
  </div>
  <div class="fc"></div>
</div>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="../js/header.js"></script>
<script type="text/javascript" src="../js/left.js"></script>
<script type="text/javascript" src="../js/footer.js"></script>
<script type="text/javascript">
clearThis("absoluteTxt");
showTab(1,1);
</script>
</body>
<!-- InstanceEnd --></html>
